package com.qf.springboot0406.service.impl;

import com.qf.springboot0406.dao.UseDao;
import com.qf.springboot0406.entity.User;
import com.qf.springboot0406.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UseDao useDao;
    @Override
    public User getUSer(Integer id) {
        return useDao.getUSerById(id);
    }

    @Override
    public void addUser(String name, String password, String sex, String birthday, String registTime) {
        useDao.insertUser(name,password,sex,birthday,registTime);
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void updateUser(Integer id, String name, String password, String sex, String birthday, String registTime) {
        useDao.updateUserById(id,name,password,sex,birthday,registTime);
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void delUser(Integer id) {
        useDao.delUser(id);
    }
}
